package jp.syuriken.snsw.terenaibot.format.function;

import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;

import jp.syuriken.snsw.terenaibot.DataProviderFactory;
import jp.syuriken.snsw.terenaibot.format.CompileArg;
import jp.syuriken.snsw.terenaibot.format.ConstSyntax;
import jp.syuriken.snsw.terenaibot.format.FormatFunction;
import jp.syuriken.snsw.terenaibot.format.PrecompiledSyntax;
import jp.syuriken.snsw.terenaibot.format.PrecompiledSyntaxGroup;
import jp.syuriken.snsw.utils.Logger;

/**
 * ブール値を使う関数のためのテンプレート
 * 
 * @author $Author$  
 */
public class FunctionTestTemplate {
	
	/** CompileArg: Not Implemented for almost */
	public static final CompileArg COMPILE_ARG;
	static {
		COMPILE_ARG = new CompileArg() {
			
			@Override
			public DataProviderFactory getDataProviderFactory() {
				return null; //TODO
			}
			
			@Override
			public FormatFunction getFormatFunction(String name) {
				return null;
			}
			
			@Override
			public Logger getLogger() {
				try {
					return Logger.getLogger(File.createTempFile("tbotsys-test", ".log").getAbsolutePath());
				} catch (IOException e) {
					fail();
					return null;
				}
			}
			
			@Override
			public String getProperty(String name) {
				return "";
			}
			
			@Override
			public String getProperty(String prefix, String name) {
				return "";
			}
			
			@Override
			public String getProperty(String prefix, String name, String defaultValue) {
				return "";
			}
			
			@Override
			public boolean parseBoolean(String string) {
				return (string.isEmpty() || string.equals("false") || string.equals("no")) == false;
			}
		};
	}
	
	/** true */
	public static final String TRUE_STR = "true";
	
	/** false */
	public static final String FALSE_STR = "false";
	
	/** "true" */
	public static final PrecompiledSyntaxGroup TRUE_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("true")
	});
	
	/** "false" */
	public static final PrecompiledSyntaxGroup FALSE_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("false")
	});
	
	/** "non" */
	public static final PrecompiledSyntaxGroup NOT_NO_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("non")
	});
	
	/** "no" */
	public static final PrecompiledSyntaxGroup NO_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("no")
	});
	
	/** "" */
	public static final PrecompiledSyntaxGroup BLANK_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("")
	});
	
	/** " " */
	public static final PrecompiledSyntaxGroup SPACE_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax(" ")
	});
	
	/** 0 */
	public static final PrecompiledSyntaxGroup ZERO_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("0")
	});
	
	/** 1 */
	public static final PrecompiledSyntaxGroup ONE_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("1")
	});
	
	/** 2 */
	public static final PrecompiledSyntaxGroup TWO_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("2")
	});
	
	/** -1 */
	public static final PrecompiledSyntaxGroup MINUS_GROUP = new PrecompiledSyntaxGroup(new PrecompiledSyntax[] {
		new ConstSyntax("-1")
	});
	

	protected FunctionTestTemplate() {
	}
}
